home *** CD-ROM | disk | FTP | other *** search
/ Skunkware 5 / Skunkware 5.iso / etc / httpd / cgi-bin / gif.search.cgi < prev    next >
Encoding:
Text File  |  1995-07-24  |  1.4 KB  |  66 lines

  1. #! /usr/skunk/bin/perl
  2. # PERL script
  3. # Searches the gifs directory for keywords.
  4.  
  5. $HTDOCS="/usr/skunk/pics/gif/";
  6. $GIFDIR="buttons";
  7. $QUERY_STRING= $ENV{'QUERY_STRING'};
  8. print "Content-type: text/html\n\n";
  9.  
  10. if ($QUERY_STRING) {
  11.     print "<HEAD>\n";
  12.     print "<TITLE>Find GIF \"$QUERY_STRING\"</TITLE>\n";
  13.     print "</HEAD>\n";
  14.     print "<BODY>\n";
  15.     print "<H1>Find GIF \"$QUERY_STRING\"</H1>\n";
  16.  
  17.     print "<UL>\n";
  18.     open(DIR, "ls $HTDOCS$GIFDIR/*.gif |");
  19.     while (<DIR>) {
  20.         if (/$QUERY_STRING/i) {
  21.             ($NAME) = m|$GIFDIR/(.*)|;
  22.             print "<LI> $HTDOCS/$GIFDIR/$NAME\n" ;
  23.             print "<IMG SRC=\"file:$HTDOCS/$GIFDIR/$NAME\">\n";
  24.             print "<P>\n";
  25.         }
  26.     }
  27.     print "</UL>\n";
  28.     print "<HR>\n";
  29. else {
  30.     print <<EOM;
  31. <HEAD>
  32. <TITLE>Find GIF</TITLE>
  33. </HEAD>
  34. <BODY>
  35. <H1>Find GIF</H1>
  36. EOM
  37. }
  38. print <<EOM;
  39. Enter a keyword to search the gif directory for.
  40. Some sample keywords are:
  41. <UL>
  42. <LI> Icon
  43. <LI> Calvin
  44. <LI> Eye
  45. </UL>
  46. <ISINDEX>
  47. <A HREF="http://www.stanford.edu/">
  48. <IMG SRC="file:/usr/skunk/pics/gif/buttons/stanford.seal56.gif" ALT="Stanford"></A>
  49.  
  50. <A HREF="http://www-cs.stanford.edu/">
  51. <IMG SRC="file:/usr/skunk/pics/gif/buttons/logo.csd.gif" ALT="CS dept"></A>
  52.  
  53. <A HREF="http://www-pcd.stanford.edu/">
  54. <IMG SRC="file:/usr/skunk/pics/gif/buttons/logo.pcd.gif" ALT="PCD grp"></A>
  55.  
  56. <A HREF="file:/usr/skunk/pics/gif/buttons/">
  57. <IMG SRC="file:/usr/skunk/pics/gif/buttons/painting.gif" ALT="Pictures"></A>
  58. <HR>
  59.  
  60. </BODY>
  61. EOM
  62.  
  63.  
  64. exit;
  65.